<?php
/*  player 0.9.1
 
    Copyright (C) 2011  Vespo Marco | http://thelairofthemad.altervista.org/

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

-----------------------------------------------------------------------------------------------*/
include_once 'trophies.class.php';
class player{
	private $id,$trophies,$avatar;
	
	function __construct($id,$trophies,$avatar){
		$this->id=$id;
		$this->trophies=$trophies;
		$this->avatar=$avatar;
	}
	public function getId(){return $this->id;}
	public function getTrophies(){return $this->trophies;}
	public function getLevel(){return (int)$this->trophies->getLevel();}
	
	function cmpLevel($a, $b) {
		if ($a->getLevel() == $b->getLevel()) return 0;
		return ($a->getLevel() < $b->getLevel()) ? 1 : -1;
	}
	
	public function __toString() {return "<image src='".$this->avatar."'>&nbsp;<b>".$this->id."</b><br>".$this->trophies;}
}
?>
